const {create} = require('axios').default


const CreateInter=  ()=>{
    const service = create();

      service.interceptors.request.use(
        (config) => {
          config.timeout = 30000; //设置超时时间
          return config;
        },
        (error) => {
          return Promise.resolve(error.request);
        }
      );
      service.interceptors.response.use(
        (response) => {
          if (response.status === 200) {
            return Promise.resolve(response);
          }
        },
        (error) => {
          return Promise.resolve(error.response);
        }
      );
      
      /** @type {AxiosInstance}*/
    return service
}

module.exports  = CreateInter